package m.jclecai.com.utils;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import m.jclecai.com.bean.JclqDXFItme;
import m.jclecai.com.bean.JclqItme;
import m.jclecai.com.bean.JclqRQSFItme;
import m.jclecai.com.bean.JclqSFItme;
import m.jclecai.com.bean.LotteryGroupBean;
import m.jclecai.com.bean.SFCItme;
import m.jclecai.com.bean.ZqBQCItem;
import m.jclecai.com.bean.ZqCBFItem;
import m.jclecai.com.bean.ZqHHItem;
import m.jclecai.com.bean.ZqItem;
import m.jclecai.com.bean.ZqJQSItem;
import m.jclecai.com.bean.ZqSPFItem;

/**
 * Created by hp on 2017/4/1.
 */

public class Utils {

    //竞彩足球所有的数据
    public static HashMap<String, List<List<String>>> JCZQ_ALL_ITEM= new HashMap<>();
    public static List<ZqItem> ZQ_ITEM_LIST = new ArrayList<>();
    public static List<List<ZqItem>> zq_jczqChilds=new ArrayList<>() ;
    //竞彩足球的胜平负的数据
    public static List<ZqSPFItem> ZQ_SPF_ITEM_LIST = new ArrayList<>();
    //竞彩足球的混合投注
    public static List<ZqHHItem> ZQ_HH_ITEM_LIST = new ArrayList<>();
    //竞彩足球的比分
    public static List<ZqCBFItem> ZQ_BF_ITEM_LIST = new ArrayList<>();
    //竞彩足球的总进球
    public static List<ZqJQSItem> ZQ_ZJQ_ITEM_LIST = new ArrayList<>();
    //竞彩足球的半全场
    public static List<ZqBQCItem> ZQ_BQC_ITEM_LIST=new ArrayList<>();

    //竞彩篮球的胜负
    public static List<LotteryGroupBean> jclqGroup = new ArrayList<>();
    public static List<JclqSFItme> JCLQ_SF_ITEM_LIST = new ArrayList<>();

    //竞彩篮球的大小分
    public static List<JclqDXFItme> JCLQ_DXF_ITEM_LIST = new ArrayList<>();
    //竞彩篮球的让球胜负
    public static List<JclqRQSFItme> JCLQ_RQSF_ITEM_LIST = new ArrayList<>();
    //胜负彩
    public static List<SFCItme> SFC_ITEM_LIST = new ArrayList<>();
    //任九场
    public static List<SFCItme> RJC_ITEM_LIST=new ArrayList<>();
    //竞彩篮球(所有类型)
    public static List<JclqItme> JCLQ_ITEM_LIST = new ArrayList<>();
    public static List<List<JclqItme>> jc_jclqChilds = new ArrayList<>();
    // 二串一
    public static int TwoAndOne(int[] arr) {
        int sum = 0;
        for (int i = 0; i < arr.length; i++) {
            int a = arr[i];
            for (int j = i + 1; j < arr.length; j++) {
                sum = sum + a * arr[j];
            }
        }
        return sum;
    }

    // 三串一
    public static int ThreeAndOne(int[] arr) {
        int sum = 0;
        // 3串1
        for (int i = 0; i < arr.length; i++) {
            int a = arr[i]; // 2
            for (int j = i + 1; j < arr.length; j++) {
                // arr[1] = arr[j]
                for (int j2 = j + 1; j2 < arr.length; j2++) {
                    // arr[2] = arr[j2]
                    sum = sum + a * arr[j] * arr[j2];
                }
            }
        }
        return sum;
    }

    // 四串一
    public static int FourAndOne(int[] arr) {
        int sum = 0;
        // 4串1
        for (int i = 0; i < arr.length; i++) {
            int a = arr[i]; // 2
            for (int j = i + 1; j < arr.length; j++) {
                // arr[1] = arr[j]
                for (int j2 = j + 1; j2 < arr.length; j2++) {
                    // arr[2] = arr[j2]
                    for (int j3 = j2 + 1; j3 < arr.length; j3++) {
                        // arr[3] = arr[j3]
                        sum = sum + a * arr[j] * arr[j2] * arr[j3];
                    }
                }
            }
        }
        return sum;
    }

    // 五串一
    public static int FiveAndOne(int[] arr) {
        int sum = 0;
        // 5串1
        for (int i = 0; i < arr.length; i++) {
            int a = arr[i]; // 2
            for (int j = i + 1; j < arr.length; j++) {
                // arr[1] = arr[j]
                for (int j2 = j + 1; j2 < arr.length; j2++) {
                    // arr[2] = arr[j2]
                    for (int j3 = j2 + 1; j3 < arr.length; j3++) {
                        // arr[3] = arr[j3]
                        for (int j4 = j3 + 1; j4 < arr.length; j4++) {
                            // arr[4] = arr[j4]
                            sum = sum + a * arr[j] * arr[j2] * arr[j3]
                                    * arr[j4];
                        }
                    }
                }
            }
        }
        return sum;
    }

    // 六串一
    public static int SixAndOne(int[] arr) {
        int sum = 0;
        // 6串1
        for (int i = 0; i < arr.length; i++) {
            int a = arr[i]; // 2
            for (int j = i + 1; j < arr.length; j++) {
                // arr[1] = arr[j]
                for (int j2 = j + 1; j2 < arr.length; j2++) {
                    // arr[2] = arr[j2]
                    for (int j3 = j2 + 1; j3 < arr.length; j3++) {
                        // arr[3] = arr[j3]
                        for (int j4 = j3 + 1; j4 < arr.length; j4++) {
                            // arr[4] = arr[j4]
                            for (int j5 = j4 + 1; j5 < arr.length; j5++) {
                                // arr[5] = arr[j5]
                                sum = sum + a * arr[j] * arr[j2] * arr[j3]
                                        * arr[j4] * arr[j5];
                            }
                        }
                    }
                }
            }
        }
        return sum;
    }

    // 七串一
    public static int QiAndOne(int[] arr) {
        int sum = 0;
        // 7串1
        for (int i = 0; i < arr.length; i++) {
            int a = arr[i]; // 2
            for (int j = i + 1; j < arr.length; j++) {
                // arr[1] = arr[j]
                for (int j2 = j + 1; j2 < arr.length; j2++) {
                    // arr[2] = arr[j2]
                    for (int j3 = j2 + 1; j3 < arr.length; j3++) {
                        // arr[3] = arr[j3]
                        for (int j4 = j3 + 1; j4 < arr.length; j4++) {
                            // arr[4] = arr[j4]
                            for (int j5 = j4 + 1; j5 < arr.length; j5++) {
                                // arr[5] = arr[j5]
                                for (int j6 = j5 + 1; j6 < arr.length; j6++) {
                                    // arr[6] = arr[j6]
                                    sum = sum + a * arr[j] * arr[j2] * arr[j3]
                                            * arr[j4] * arr[j5] * arr[j6];
                                }
                            }
                        }
                    }
                }
            }
        }
        return sum;
    }

    // 八串一
    public static int BaAndOne(int[] arr) {
        int sum = 0;
        // 8串1
        for (int i = 0; i < arr.length; i++) {
            int a = arr[i]; // 2
            for (int j = i + 1; j < arr.length; j++) {
                // arr[1] = arr[j]
                for (int j2 = j + 1; j2 < arr.length; j2++) {
                    // arr[2] = arr[j2]
                    for (int j3 = j2 + 1; j3 < arr.length; j3++) {
                        // arr[3] = arr[j3]
                        for (int j4 = j3 + 1; j4 < arr.length; j4++) {
                            // arr[4] = arr[j4]
                            for (int j5 = j4 + 1; j5 < arr.length; j5++) {
                                // arr[5] = arr[j5]
                                for (int j6 = j5 + 1; j6 < arr.length; j6++) {
                                    // arr[6] = arr[j6]
                                    for (int j7 = j6 + 1; j7 < arr.length; j7++) {
                                        sum = sum + a * arr[j] * arr[j2]
                                                * arr[j3] * arr[j4] * arr[j5]
                                                * arr[j6] * arr[j7];
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        return sum;
    }

    public static int setChuang(int[] arr, int what) {
        int sum = 0;
        switch (what) {
            case 2:
                // 2串1
                for (int i = 0; i < arr.length; i++) {
                    int a = arr[i];
                    for (int j = i + 1; j < arr.length; j++) {
                        sum = sum + a * arr[j];
                    }
                }
                break;
            case 3:
                // 3串1
                for (int i = 0; i < arr.length; i++) {
                    int a = arr[i]; // 2
                    for (int j = i + 1; j < arr.length; j++) {
                        // arr[1] = arr[j]
                        for (int j2 = j + 1; j2 < arr.length; j2++) {
                            // arr[2] = arr[j2]
                            sum = sum + a * arr[j] * arr[j2];
                        }
                    }
                }
                break;
            case 4:
                // 4串1
                for (int i = 0; i < arr.length; i++) {
                    int a = arr[i]; // 2
                    for (int j = i + 1; j < arr.length; j++) {
                        // arr[1] = arr[j]
                        for (int j2 = j + 1; j2 < arr.length; j2++) {
                            // arr[2] = arr[j2]
                            for (int j3 = j2 + 1; j3 < arr.length; j3++) {
                                // arr[3] = arr[j3]
                                sum = sum + a * arr[j] * arr[j2] * arr[j3];
                            }
                        }
                    }
                }
                break;
            case 5:
                // 5串1
                for (int i = 0; i < arr.length; i++) {
                    int a = arr[i]; // 2
                    for (int j = i + 1; j < arr.length; j++) {
                        // arr[1] = arr[j]
                        for (int j2 = j + 1; j2 < arr.length; j2++) {
                            // arr[2] = arr[j2]
                            for (int j3 = j2 + 1; j3 < arr.length; j3++) {
                                // arr[3] = arr[j3]
                                for (int j4 = j3 + 1; j4 < arr.length; j4++) {
                                    // arr[4] = arr[j4]
                                    sum = sum + a * arr[j] * arr[j2] * arr[j3]
                                            * arr[j4];
                                }
                            }
                        }
                    }
                }
                break;
            case 6:
                // 6串1
                for (int i = 0; i < arr.length; i++) {
                    int a = arr[i]; // 2
                    for (int j = i + 1; j < arr.length; j++) {
                        // arr[1] = arr[j]
                        for (int j2 = j + 1; j2 < arr.length; j2++) {
                            // arr[2] = arr[j2]
                            for (int j3 = j2 + 1; j3 < arr.length; j3++) {
                                // arr[3] = arr[j3]
                                for (int j4 = j3 + 1; j4 < arr.length; j4++) {
                                    // arr[4] = arr[j4]
                                    for (int j5 = j4 + 1; j5 < arr.length; j5++) {
                                        // arr[5] = arr[j5]
                                        sum = sum + a * arr[j] * arr[j2] * arr[j3]
                                                * arr[j4] * arr[j5];
                                    }
                                }
                            }
                        }
                    }
                }
                break;
            case 7:
                // 7串1
                for (int i = 0; i < arr.length; i++) {
                    int a = arr[i]; // 2
                    for (int j = i + 1; j < arr.length; j++) {
                        // arr[1] = arr[j]
                        for (int j2 = j + 1; j2 < arr.length; j2++) {
                            // arr[2] = arr[j2]
                            for (int j3 = j2 + 1; j3 < arr.length; j3++) {
                                // arr[3] = arr[j3]
                                for (int j4 = j3 + 1; j4 < arr.length; j4++) {
                                    // arr[4] = arr[j4]
                                    for (int j5 = j4 + 1; j5 < arr.length; j5++) {
                                        // arr[5] = arr[j5]
                                        for (int j6 = j5 + 1; j6 < arr.length; j6++) {
                                            // arr[6] = arr[j6]
                                            sum = sum + a * arr[j] * arr[j2]
                                                    * arr[j3] * arr[j4] * arr[j5]
                                                    * arr[j6];
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                break;
            case 8:
                // 8串1
                for (int i = 0; i < arr.length; i++) {
                    int a = arr[i]; // 2
                    for (int j = i + 1; j < arr.length; j++) {
                        // arr[1] = arr[j]
                        for (int j2 = j + 1; j2 < arr.length; j2++) {
                            // arr[2] = arr[j2]
                            for (int j3 = j2 + 1; j3 < arr.length; j3++) {
                                // arr[3] = arr[j3]
                                for (int j4 = j3 + 1; j4 < arr.length; j4++) {
                                    // arr[4] = arr[j4]
                                    for (int j5 = j4 + 1; j5 < arr.length; j5++) {
                                        // arr[5] = arr[j5]
                                        for (int j6 = j5 + 1; j6 < arr.length; j6++) {
                                            // arr[6] = arr[j6]
                                            for (int j7 = j6 + 1; j7 < arr.length; j7++) {
                                                sum = sum + a * arr[j] * arr[j2]
                                                        * arr[j3] * arr[j4]
                                                        * arr[j5] * arr[j6]
                                                        * arr[j7];
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                break;
            case 9:
                // 9串1
                for (int i = 0; i < arr.length; i++) {
                    int a = arr[i]; // 2
                    for (int j = i + 1; j < arr.length; j++) {
                        // arr[1] = arr[j]
                        for (int j2 = j + 1; j2 < arr.length; j2++) {
                            // arr[2] = arr[j2]
                            for (int j3 = j2 + 1; j3 < arr.length; j3++) {
                                // arr[3] = arr[j3]
                                for (int j4 = j3 + 1; j4 < arr.length; j4++) {
                                    // arr[4] = arr[j4]
                                    for (int j5 = j4 + 1; j5 < arr.length; j5++) {
                                        // arr[5] = arr[j5]
                                        for (int j6 = j5 + 1; j6 < arr.length; j6++) {
                                            // arr[6] = arr[j6]
                                            for (int j7 = j6 + 1; j7 < arr.length; j7++) {
                                                // arr[7] = arr[j7]
                                                for (int j8 = j7 + 1; j8 < arr.length; j8++) {
                                                    sum = sum + a * arr[j]
                                                            * arr[j2] * arr[j3]
                                                            * arr[j4] * arr[j5]
                                                            * arr[j6] * arr[j7]
                                                            * arr[j8];
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                break;
        }
        return sum;
    }

    public static Double setBonus(Double[] arr, int what) {
        Double sum = 0.00;
        switch (what) {
            case 2:
                // 2串1
                for (int i = 0; i < arr.length; i++) {
                    Double a = arr[i];
                    for (int j = i + 1; j < arr.length; j++) {
                        sum = sum + a * arr[j];
                    }
                }
                break;
            case 3:
                // 3串1
                for (int i = 0; i < arr.length; i++) {
                    Double a = arr[i]; // 2
                    for (int j = i + 1; j < arr.length; j++) {
                        // arr[1] = arr[j]
                        for (int j2 = j + 1; j2 < arr.length; j2++) {
                            // arr[2] = arr[j2]
                            sum = sum + a * arr[j] * arr[j2];
                        }
                    }
                }
                break;
            case 4:
                // 4串1
                for (int i = 0; i < arr.length; i++) {
                    Double a = arr[i]; // 2
                    for (int j = i + 1; j < arr.length; j++) {
                        // arr[1] = arr[j]
                        for (int j2 = j + 1; j2 < arr.length; j2++) {
                            // arr[2] = arr[j2]
                            for (int j3 = j2 + 1; j3 < arr.length; j3++) {
                                // arr[3] = arr[j3]
                                sum = sum + a * arr[j] * arr[j2] * arr[j3];
                            }
                        }
                    }
                }
                break;
            case 5:
                // 5串1
                for (int i = 0; i < arr.length; i++) {
                    Double a = arr[i]; // 2
                    for (int j = i + 1; j < arr.length; j++) {
                        // arr[1] = arr[j]
                        for (int j2 = j + 1; j2 < arr.length; j2++) {
                            // arr[2] = arr[j2]
                            for (int j3 = j2 + 1; j3 < arr.length; j3++) {
                                // arr[3] = arr[j3]
                                for (int j4 = j3 + 1; j4 < arr.length; j4++) {
                                    // arr[4] = arr[j4]
                                    sum = sum + a * arr[j] * arr[j2] * arr[j3]
                                            * arr[j4];
                                }
                            }
                        }
                    }
                }
                break;
            case 6:
                // 6串1
                for (int i = 0; i < arr.length; i++) {
                    Double a = arr[i]; // 2
                    for (int j = i + 1; j < arr.length; j++) {
                        // arr[1] = arr[j]
                        for (int j2 = j + 1; j2 < arr.length; j2++) {
                            // arr[2] = arr[j2]
                            for (int j3 = j2 + 1; j3 < arr.length; j3++) {
                                // arr[3] = arr[j3]
                                for (int j4 = j3 + 1; j4 < arr.length; j4++) {
                                    // arr[4] = arr[j4]
                                    for (int j5 = j4 + 1; j5 < arr.length; j5++) {
                                        // arr[5] = arr[j5]
                                        sum = sum + a * arr[j] * arr[j2] * arr[j3]
                                                * arr[j4] * arr[j5];
                                    }
                                }
                            }
                        }
                    }
                }
                break;
            case 7:
                // 7串1
                for (int i = 0; i < arr.length; i++) {
                    Double a = arr[i]; // 2
                    for (int j = i + 1; j < arr.length; j++) {
                        // arr[1] = arr[j]
                        for (int j2 = j + 1; j2 < arr.length; j2++) {
                            // arr[2] = arr[j2]
                            for (int j3 = j2 + 1; j3 < arr.length; j3++) {
                                // arr[3] = arr[j3]
                                for (int j4 = j3 + 1; j4 < arr.length; j4++) {
                                    // arr[4] = arr[j4]
                                    for (int j5 = j4 + 1; j5 < arr.length; j5++) {
                                        // arr[5] = arr[j5]
                                        for (int j6 = j5 + 1; j6 < arr.length; j6++) {
                                            // arr[6] = arr[j6]
                                            sum = sum + a * arr[j] * arr[j2]
                                                    * arr[j3] * arr[j4] * arr[j5]
                                                    * arr[j6];
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                break;
            case 8:
                // 8串1
                for (int i = 0; i < arr.length; i++) {
                    Double a = arr[i]; // 2
                    for (int j = i + 1; j < arr.length; j++) {
                        // arr[1] = arr[j]
                        for (int j2 = j + 1; j2 < arr.length; j2++) {
                            // arr[2] = arr[j2]
                            for (int j3 = j2 + 1; j3 < arr.length; j3++) {
                                // arr[3] = arr[j3]
                                for (int j4 = j3 + 1; j4 < arr.length; j4++) {
                                    // arr[4] = arr[j4]
                                    for (int j5 = j4 + 1; j5 < arr.length; j5++) {
                                        // arr[5] = arr[j5]
                                        for (int j6 = j5 + 1; j6 < arr.length; j6++) {
                                            // arr[6] = arr[j6]
                                            for (int j7 = j6 + 1; j7 < arr.length; j7++) {
                                                sum = sum + a * arr[j] * arr[j2]
                                                        * arr[j3] * arr[j4]
                                                        * arr[j5] * arr[j6]
                                                        * arr[j7];
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                break;
        }
        return sum;
    }
}
